package cate.game.activity.worldboss.msg;

import cate.game.GameBody;
import cate.game.activity.battleroyale.po.RoleBattleRoyale;
import cate.game.activity.worldboss.RoleWorldBoss;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBBattleRoyale;
import cate.game.client.msg.id.MsgIdBWorldBoss;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "世界boss挑战 の 请求")
public class WorldBossChallengeReq implements MsgInput {
    @NoteField(value = "功能id")
    public int funcId;


    @Override
    public void execute(GameBody game, ClientContext cc) {
        RoleWorldBoss single = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (single == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        EcResult<Void> r = single.challenge();
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBWorldBoss.CHALLENGE_REQ;
    }
}
